#include <iostream>

using namespace std;
int n;
const int N = 100010;
int num[N] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
int arr[N];
int res;
void dfs(int x, int fire)
{
    if (fire > n)
    {
        return;
    }
    if (x > 3)
    {
        if (arr[1] + arr[2] == arr[3] && n == fire)
        {
            res++;
        }
        return;
    }
    for (int i = 0; i <= 1000; i++)
    {
        arr[x] = i;
        dfs(x + 1, fire + num[i]);
    }
}
int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    n -= 4;
    for (int i = 10; i <= 1000; i++)
    {
        num[i] = num[i % 10] + num[i / 10];
    }
    dfs(1, 0);
    cout << res << endl;
    return 0;
}